package com.hzw.saas.service.ds.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzw.saas.api.ds.IMarketingAdService;
import com.hzw.saas.api.ds.bo.MarketingAdBo;
import com.hzw.saas.api.ds.enums.ClientTypeEnum;
import com.hzw.saas.common.util.MapperUtil;
import com.hzw.saas.service.ds.mapper.MarketingAdMapper;
import com.hzw.saas.service.ds.model.MarketingAd;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MarketingAdServiceImpl extends ServiceImpl<MarketingAdMapper, MarketingAd> implements IMarketingAdService, IService<MarketingAd> {

    @Override
    public List<MarketingAdBo> getMarketingAds(ClientTypeEnum clientType) {
        List<MarketingAd> marketingAdList = super.lambdaQuery()
                .eq(MarketingAd::getClientType, clientType)
                .list();
        return MapperUtil.nf().mapAsList(marketingAdList, MarketingAdBo.class);
    }
}
